﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using ARR.Entities.Gateways;

namespace ARR.Entities
{
    [DataContract]
    [Serializable]
    public class SalesCategoryComparisonBySpace : EntityBase
    {
        [DataMember]
        SalesCategoryComparisonBySpaceRow row;

        public SalesCategoryComparisonBySpace(SalesCategoryComparisonBySpaceRow row)
        {
            this.row = row;
        }

        public SalesCategoryComparisonBySpace()
        {
            row = new SalesCategoryComparisonBySpaceRow();
        }

        public override void Initialize()
        {
            row = new SalesCategoryComparisonBySpaceRow();
        }

        
        [DataMember]
        public int Id
        {
            get { return row.Id; }
            set { row.Id = value; }
        }

        [DataMember]
        public string Code
        {
            get { return row.Code; }
            set { row.Code = value; }
        }

        [DataMember]
        public string Name
        {
            get { return row.Name; }
            set { row.Name = value; }
        }

        [DataMember]
        public decimal Units
        {
            get { return row.Units; }
            set { row.Units = value; }
        }
                
        [DataMember]
        public decimal Sales
        {
            get { return row.Sales; }
            set { row.Sales = value; }
        }

        [DataMember]
        public decimal GM
        {
            get { return row.GM; }
            set { row.GM = value; }
        }
                
        [DataMember]
        public string Category
        {
            get { return row.Category; }
            set { row.Category = value; }
        }
                
        [DataMember]
        public bool Delist
        {
            get { return row.Delist; }
            set { row.Delist = value; }
        }      
        
        [DataMember]
        public decimal Width
        {
            get { return row.Width; }
            set { row.Width = value; }
        }

        [DataMember]
        public decimal Facings
        {
            get { return row.Facings; }
            set { row.Facings = value; }
        }

        [DataMember]
        public decimal InventoryCost
        {
            get { return row.InventoryCost; }
            set { row.InventoryCost = value; }
        }

        [DataMember]
        public string Planograms
        {
            get { return row.Planograms; }
            set { row.Planograms = value; }
        }

        [DataMember]
        public bool IsDeletedRangeReview
        {
            get { return row.IsDeletedRangeReview; }
            set { row.IsDeletedRangeReview = value; }
        }

        [DataMember]
        public string Brand
        {
            get { return row.Brand; }
            set { row.Brand = value; }
        }

        [DataMember]
        public decimal LinearSpaceMts
        {
            get
            {
                return row.LinearSpace / 100;
            }
            set
            {
                row.LinearSpace = value * 100;
            }
        }
        
        [DataMember]
        public string Location1
        {
            get
            {
                return row.Location1;
            }
            set
            {
                row.Location1 = value;
            }
        }
        
        [DataMember]
        public int? PlanogramTypeId
        {
            get
            {
                return row.PlanogramTypeId;
            }
            set
            {
                row.PlanogramTypeId = value;
            }
        }
        
        public string PlanogramTypeName
        {
            get
            {
                if(row.PlanogramTypeId.HasValue)
                    return Enum.GetName(typeof(PlanogramType), row.PlanogramTypeId);

                return "No Space";
            }
        }
    }
}
